package ntu.metaweb.result;

import java.util.Iterator;
import java.util.Vector;

import com.thoughtworks.xstream.annotations.XStreamAlias;

import ntu.metaweb.storage.WebPage;

@XStreamAlias("xmlresponse")
public class Comments {
	@XStreamAlias("chatroomjid")
	public String chatRoomJID;
	@XStreamAlias("resultno")
	public int resultNumber;
	@XStreamAlias("comments")
	public Vector<Comment> commentList;
	
	public Comments(WebPage webPage) {
		System.out.println("create comment");
		this.chatRoomJID = "";
		this.resultNumber = webPage.getCommentsNumber();
		this.commentList = new Vector<Comment>();
		Iterator<ntu.metaweb.storage.Comment> comments = webPage.getComments();

		while (comments.hasNext()) {
			this.commentList.add(new Comment(comments.next()));
		}
	}
}
